/*******************************************************************************
 * This code is totally free to edit and be distributed
 * Author: José Manuel Portero García (jmporterog@gmail.com)
 ******************************************************************************/
/**
 * 
 */
package gazpachito.examples.dozer.persistence;

import java.io.Serializable;
import java.util.Set;

/**
 * @author jmporterog
 *
 */
public class ParentVO implements Serializable {

	private static final long serialVersionUID = 440303735656145958L;

	protected Integer persistenceId;
	
	protected String name;
	
	protected Set<ChildVO> childVOs;

	public Integer getPersistenceId() {
		return persistenceId;
	}

	public void setPersistenceId(Integer persistenceId) {
		this.persistenceId = persistenceId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<ChildVO> getChildVOs() {
		return childVOs;
	}

	public void setChildVOs(Set<ChildVO> childVOs) {
		this.childVOs = childVOs;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((childVOs == null) ? 0 : childVOs.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((persistenceId == null) ? 0 : persistenceId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ParentVO other = (ParentVO) obj;
		if (childVOs == null) {
			if (other.childVOs != null)
				return false;
		} else if (!childVOs.equals(other.childVOs))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (persistenceId == null) {
			if (other.persistenceId != null)
				return false;
		} else if (!persistenceId.equals(other.persistenceId))
			return false;
		return true;
	}
}
